import { AddFormatFunc, functionRuleType } from "../types";

AddFormatFunc<functionRuleType>({

	type: "FUNCTION",

	handle: (rule, FMC) => {
		return `function${rule[1].length === 0 ? "" : ` ${FMC(rule[1])}`}${FMC(rule[2])}(${rule[3].length === 0 ? "" : `${FMC(rule[3][0][0])}${rule[3][0][1].length === 0 ? "" : `: ${FMC(rule[3][0][1])}`}`}){\n${rule[4].map(item => FMC(item)).join("\n")}\n}`
	},

})
